home *** CD-ROM | disk | FTP | other *** search
- ATARI MACHINE SPECIFIC LIBRARY
-
-
-
- NAME
- Shape - some shape classes
-
- SYNOPSIS
- #include <Shape.h>
-
- struct Point
- struct Line : Point
- struct Rectangle : Point
-
- DESCRIPTION
- Graphical programs often refer to (x,y) coordinates,
- (x1,y1,x2,y2) areas, etc.. This module provides these as simple
- structs.
-
- CLASSES
- A Point is an (x,y) coordinate.
- A Line is a Point with another Point defining its end.
- A Rectangle is a Point with a width and height. Exactly which
- corner the "Point" coordinate refers to is not defined, but
- determined by usage. Usually the top-left is inferred.
-
- CLASS MEMBERS
- Point::
- int x,y
- The coordinates.
- Point()
- Create the point at the origin (0,0).
- Point(int X,int Y)
- Create the point with the given coordinates.
- void MoveTo(int X,int Y)
- Move the point to the given coordinates.
- void MoveBy(int X,int Y)
- Move the point by the given amounts.
- void Bound(const Rectangle& R)
- Bound the point to the given area.
- The point moves back to the closest edge if out of bounds.
-
- Line::
- Line()
- Create a line from (0,0) to (1,0)
- Line(int x1,int y1,int x2, int y2)
- Create a line from (x1,y1) to (x2,y2)
- Point end
- The point at the end of the line
-
- Rectangle::
- int w,h
- The width and height of the point
- Rectangle()
- Create a 1 by 1 rectangle with its corner at the origin.
- Rectangle(int X,int Y,int W, int H)
- Create a W by H rectangle with its corner at (X,Y).
- void Area(int W,int H)
- Set the rectangles area.
- int Area()
- Calculate the rectangles area (in square units).
- Rectangle& operator*= (int m)
- Multiply the size of the rectangle by m.
-
- BUGS
- These structs should be used more in the AMS Library.
-
- AUTHOR
- Warwick Allison, 1992.
- warwick@cs.uq.oz.au
-
- COPYING
- This functionality is part of the Atari Machine Specific Library,
- and is Copyright 1992 by Warwick W. Allison.
-
- The Atari Machine Specific Library is free and protected under the
- GNU Library General Public License.
-
- You are free to copy and modify these sources, provided you acknowledge
- the origin by retaining this notice, and adhere to the conditions
- described in the GNU LGPL.
-